'use strict';

// let nunjucks = require('nunjucks');

let login_fn = async (ctx,next)=>{
    ctx.render('hello.html');
};
let homePage_fn = async (ctx,next)=>{
    ctx.body = `
        <h1>用户信息：</h1>
        姓名：张三
        <br />
        性别：男
        <br />
        年龄：21
    `
};
let loginDone_fn = async (ctx,next)=>{
    let username = ctx.request.body.username;
    let password = ctx.request.body.password;

    if(username === 'root' && password === '123'){
        ctx.redirect('homePage');
    }
};

module.exports = {
    '/':['get',login_fn],
    '/homePage':['get',homePage_fn],
    '/loginDone':['post',loginDone_fn]
}